package com.example.springboot.mapper;


import com.example.springboot.pojo.AdRequest;
import org.apache.ibatis.annotations.*;

@Mapper
public interface AdRequestMapper {

    @Select("select * from ad_request where id=#{id}")
    AdRequest findById(Integer id);

    @Insert("insert into ad_request(name,email,phone_number,company,ad_detail)"
            + " values(#{name},#{email},#{phoneNumber},#{company},#{adDetail})")
    void addAdRequest(String name, String email, String phoneNumber, String company, String adDetail);

    @Select("select * from ad_request")
    AdRequest[] getAllAdRequest();

    @Delete("delete from ad_request where id=#{id}")
    void deleteAdRequest(Integer id);

    @Update("update ad_request set status=1 where id=#{id}")
    void passAdRequest(Integer id);

    @Update("update ad_request set status=2 where id=#{id}")
    void refuseAdRequest(Integer id);
}
